#include "s_exchangeshow.h"
#include "ui_s_exchangeshow.h"

s_exchangeShow::s_exchangeShow(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::s_exchangeShow)
{
    ui->setupUi(this);
    querytable();
}

s_exchangeShow::~s_exchangeShow()
{
    delete ui;
}

void s_exchangeShow::querytable(){
    QSqlQuery query;
    QString str=QString("SELECT * FROM dorm2.exchangroom_h where stu_sid='%1'").arg(global::userid);

    qDebug()<<str;
    model.setQuery(str);
    ui->tableView->setModel(&model);
    //ui->tableView->setColumnHidden(7,true);

    model.setHeaderData(0,Qt::Horizontal,"学号");
    model.setHeaderData(1,Qt::Horizontal,"学生姓名");
    model.setHeaderData(2,Qt::Horizontal,"目标宿舍");
    model.setHeaderData(3,Qt::Horizontal,"目标楼栋");
    model.setHeaderData(4,Qt::Horizontal,"现居宿舍");
    model.setHeaderData(5,Qt::Horizontal,"现居楼栋");
    model.setHeaderData(6,Qt::Horizontal,"处理状态");
    //model.setHeaderData(8,Qt::Horizontal,"宿舍号");

}
